{namespace mazepage}

/**
 * This is a Closure Template.  Build with:
 * java -jar ../_soy/SoyToJsSrcCompiler.jar --outputPathFormat template.js --srcs template.soy
 */

/**
 * Web page structure.
 */
{template .start}
  <table width="100%" height="100%">
    <tr>
      <td width="410" valign="top">
        <h1><a href="http://blockly.googlecode.com/">Blockly</a> &gt;{sp}
            <a href="../index.html">Apps</a> &gt; {$ij.MSG.title}</h1>

        <p class="levelLine">{$ij.MSG.level}: &nbsp;
        {for $i in range(1, 11)}
          {if $i == $ij.level}
            <span class="tab" id="selected">{$i}</span>
          {else}
            <a class="tab" href="?level={$i}">{$i}</a>
          {/if}
        {/for}
        </p>

        <div id="bubble">
          <div id="hint">{$ij.MSG.hints[$ij.level]}</div>
          <div id="capacity"></div>
        </div>
        <img id="pegman_bubble" height=42 width=55 src="pegman_bubble.png">

        <div>
          <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="svgMaze" width="400px" height="400px">
        </div>

        <table width="100%">
          <tr>
            <td id="toolbarDiv">
              <button title="{$ij.MSG.codeTooltip}" onclick="Maze.showCode();">
                <img src='../../media/1x1.gif' class="code">
              </button>
              <button id="linkButton" title="{$ij.MSG.linkTooltip}" onclick="BlocklyStorage.link();">
                <img src='../../media/1x1.gif' class="link">
              </button>
              <button id="randomizeButton" onclick="Maze.randomize();" style="display: none">
                <img src='../../media/1x1.gif' class="random">
              </button>
            </td>
            <td id="buttonDiv">
              <button id="runButton" class="launch" onclick="Maze.runButtonClick();">
                {$ij.MSG.runProgram}
              </button>
              <button id="resetButton" class="launch" onclick="Maze.resetButtonClick();" style="display: none">
                {$ij.MSG.resetProgram}
              </button>
            </td>
          </tr>
        </table>
      </td>

      <td valign="top">
        {call .toolbox /}
        <iframe src="frame.html?{$ij.frameSrc}"></iframe>
      </td>
    </tr>
  </table>
{/template}

/**
 * Toolboxes for each level.
 */
{template .toolbox}
  {if $ij.level < 10}
    <xml id="toolbox" style="display: none">
      <block type="maze_moveForward"></block>
      <block type="maze_turn"><title name="DIR">turnLeft</title></block>
      <block type="maze_turn"><title name="DIR">turnRight</title></block>
      {if $ij.level > 2}
        <block type="maze_forever"></block>
        {if $ij.level > 4}
          <block type="maze_if"></block>
          {if $ij.level > 7}
            <block type="maze_ifElse"></block>
          {/if}
        {/if}
      {/if}
    </xml>
  {else}
    <xml id="toolbox" style="display: none">
      <category name="{$ij.MSG.catMaze}">
        <block type="maze_move"></block>
        <block type="maze_turn"><title name="DIR">turnLeft</title></block>
        <block type="maze_turn"><title name="DIR">turnRight</title></block>
        <block type="maze_isPath"></block>
        <block type="maze_getX"></block>
        <block type="maze_getY"></block>
        <block type="maze_getDirection"></block>
      </category>
      <category name="{$ij.MSG.catControl}">
        <block type="controls_if"></block>
        <block type="controls_repeat"></block>
        <block type="controls_whileUntil"></block>
        <block type="controls_for">
          <value name="FROM">
            <block type="math_number">
              <title name="NUM">1</title>
            </block>
          </value>
          <value name="TO">
            <block type="math_number">
              <title name="NUM">10</title>
            </block>
          </value>
        </block>
        <block type="controls_forEach"></block>
        <block type="controls_flow_statements"></block>
      </category>
      <category name="{$ij.MSG.catLogic}">
        <block type="logic_compare"></block>
        <block type="logic_operation"></block>
        <block type="logic_negate"></block>
        <block type="logic_boolean"></block>
        <block type="logic_null"></block>
        <block type="logic_ternary"></block>
      </category>
      <category name="{$ij.MSG.catMath}">
        <block type="math_number"></block>
        <block type="math_arithmetic"></block>
        <block type="math_single"></block>
        <block type="math_trig"></block>
        <block type="math_constant"></block>
        <block type="math_number_property"></block>
        <block type="math_change">
          <value name="DELTA">
            <block type="math_number">
              <title name="NUM">1</title>
            </block>
          </value>
        </block>
        <block type="math_round"></block>
        <block type="math_on_list"></block>
        <block type="math_modulo"></block>
        <block type="math_constrain">
          <value name="LOW">
            <block type="math_number">
              <title name="NUM">1</title>
            </block>
          </value>
          <value name="HIGH">
            <block type="math_number">
              <title name="NUM">100</title>
            </block>
          </value>
        </block>
        <block type="math_random_int">
          <value name="FROM">
            <block type="math_number">
              <title name="NUM">1</title>
            </block>
          </value>
          <value name="TO">
            <block type="math_number">
              <title name="NUM">100</title>
            </block>
          </value>
        </block>
        <block type="math_random_float"></block>
      </category>
      <category name="{$ij.MSG.catLists}">
        <block type="lists_create_empty"></block>
        <block type="lists_create_with"></block>
        <block type="lists_repeat">
          <value name="NUM">
            <block type="math_number">
              <title name="NUM">5</title>
            </block>
          </value>
        </block>
        <block type="lists_length"></block>
        <block type="lists_isEmpty"></block>
        <block type="lists_indexOf">
          <value name="VALUE">
            <block type="variables_get">
              <title name="VAR">list</title>
            </block>
          </value>
        </block>
        <block type="lists_getIndex">
          <value name="VALUE">
            <block type="variables_get">
              <title name="VAR">list</title>
            </block>
          </value>
        </block>
        <block type="lists_setIndex">
          <value name="LIST">
            <block type="variables_get">
              <title name="VAR">list</title>
            </block>
          </value>
        </block>
        <block type="lists_getSublist">
          <value name="LIST">
            <block type="variables_get">
              <title name="VAR">list</title>
            </block>
          </value>
        </block>
      </category>
      <category name="{$ij.MSG.catVariables}" custom="VARIABLE"></category>
      <category name="{$ij.MSG.catProcedures}" custom="PROCEDURE"></category>
    </xml>
  {/if}
{/template}
